package cn.edu.jxau.core.util.druip;

import com.alibaba.druid.pool.DruidDataSourceFactory;

import javax.sql.DataSource;
import java.util.Properties;

public class DataSourceUtil {  
    
	private static DataSource dataSource;
	
	public static DataSource getInstance(Properties config) {
		
		

		if (dataSource == null) {
			synchronized (DataSourceUtil.class) {
				if (dataSource == null)
					try {
						dataSource = DruidDataSourceFactory.createDataSource(config);
					} catch (Exception e) {
						e.printStackTrace();
					}
			}

		}

		
		
		return dataSource;
	}
}